import {View, Text} from 'react-native';
import {Picker} from '@react-native-picker/picker';
import React from 'react';

export default function pickerCom() {
  const [selectedLanguage, setSelectedLanguage] = React.useState('java');
  return (
    <View>
      <Picker
        selectedValue={selectedLanguage}
        mode={'dropdown'} // 只有在android下生效
        onValueChange={(itemValue, itemIndex) =>
          setSelectedLanguage(itemValue)
        }>
        <Picker.Item label="Java" value="java" />
        <Picker.Item label="JavaScript" value="js" />
      </Picker>
    </View>
  );
}
